/**
 * 套件的模型定义
 */

import { getDefaultFields } from "../utils";



/**
 * 套件
 * @param app 
 */
export default (app) => {
  const DataTypes = app.Sequelize;


  const Model = app.model.define('portal_def', {
    id: {
      type: DataTypes.INTEGER(8).UNSIGNED,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true
    },
    type: {
      type: DataTypes.STRING(255),
      allowNull: false,
      comment: '套件类型'
    },
    title: {
      type: DataTypes.STRING(255),
      allowNull: false,
      comment: '套件名称'
    },
    sort_id: {
      type: DataTypes.INTEGER(8),
      allowNull: true,
    },
    page_id: {
      type: DataTypes.INTEGER(8),
      allowNull: false,
    },
    properties: {
      type: DataTypes.STRING(1000),
      allowNull: false,
    },
    ...getDefaultFields()
  }, {
    tableName: 'portal_def',
    timestamps: false
  });

  Model.sync({ alter: true });
  return Model;
}


